import service from './request.js';
import qs from 'qs';

// 获得交易记录
export function getPayRecords(data) {
  return service({
    url: '/api/getPayRecordInfo',
    method: 'POST',
    data
  });
}


// 生成二维码
export function getQrcode(data) {
  return service({
    url: '/api/generateQrCode',
    method: 'POST',
    header: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  });
}

/**
 * @param {Object} data
 * 获取系统通知数据
 * 获取交易通知数据
 * 获取是否有未读消息
 * 通知后台该消息已读
 */
export function getSystemNotice(data) {
  return service({
    url: '/api/getSystemNotice',
    method: 'POST',
    data
  });
}


export function getTradeNotice(data) {
  return service({
    url: '/api/getTradeNotice',
    method: 'POST',
    data
  });
}


export function hasUnreadNotice(data) {
  return service({
    url: '/api/hasUnreadNotice',
    method: 'POST',
    data
  });
}


export function markMessagesAsRead(data) {
  return service({
    url: '/api/markMessagesAsRead',
    method: 'POST',
    data
  });
}



/**
 * @param {Object} data
 * 获取全部交易数据
 * 获取支出交易数据
 * 获取充值交易数据
 * 获取退款交易数据
 */
export function getAllTransactions(data) {
  return service({
    url: '/api/transactions/all',
    method: 'POST',
    data
  });
}

export function getExpenseTransactions(data) {
  return service({
    url: '/api/transactions/expense',
    method: 'POST',
    data
  });
}

export function getRechargeTransactions(data) {
  return service({
    url: '/api/transactions/recharge',
    method: 'POST',
    data
  });
}


export function getRefundTransactions(data) {
  return service({
    url: '/api/transactions/refund',
    method: 'POST',
    data
  });
}

